/*
 *	dfclient_actions.c
 *	© 2009 DigiFi Limited
 *
 *	The actions (play, pause, stop ...) part of dfclient
 *
 */

#include "../headers/dfvoid.h"

extern unsigned int df_currentRoom;


int dfvoid_play(unsigned int room_id) {
	return df_queuecommand(DF_VOID_COMMAND, "void", NULL, "[Play %d]", room_id);
}

int dfvoid_stop(unsigned int room_id) {
	return df_queuecommand(DF_VOID_COMMAND, "void", NULL, "[Stop %d]", room_id);
}

int dfvoid_pause(unsigned int room_id) {
	return df_queuecommand(DF_VOID_COMMAND, "void", NULL, "[Pause %d]", room_id);
}

int dfvoid_next(unsigned int room_id) {
	return df_queuecommand(DF_VOID_COMMAND, "void", NULL, "[NextTrack %d]", room_id);
}

int dfvoid_previous(unsigned int room_id) {
	return df_queuecommand(DF_VOID_COMMAND, "void", NULL, "[PrevTrack %d]", room_id);
}


int dfvoid_playalbum(unsigned int room_id, unsigned int replace, char* address, unsigned int start_number) {
	return df_queuecommand(DF_VOID_COMMAND, "void", NULL, "[PlayAlbum %u %u \"%s\" %u]",
		room_id, (replace==1) ? replace : 0, address, start_number);
}

int dfvoid_playtrack(unsigned int room_id, unsigned int replace, char* address) {
	return df_queuecommand(DF_VOID_COMMAND, "void", NULL, "[PlayTrack %u %u \"%s\"]",
		room_id, (replace==1) ? replace : 0, address);
}

int dfvoid_createrandomplaylist(unsigned int room_id, char *genre, char *sub_genre,
 			char *artists, char *albums, int max_tracks, char *restricted_tracks) {
	if (max_tracks < 0) {
		return df_queuecommand(DF_VOID_COMMAND, "void", NULL, "[CreateRandomPlaylist %u \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"]",
			room_id, genre, sub_genre, artists, albums, restricted_tracks);
	}
	else {
		return df_queuecommand(DF_VOID_COMMAND, "void", NULL, "[CreateRandomPlaylist %u \"%s\" \"%s\" \"%s\" \"%s\" %d \"%s\"]",
			room_id, genre, sub_genre, artists, albums, max_tracks, restricted_tracks);
	}
}

int dfvoid_clearplaylist(unsigned int room_id) {
	return df_queuecommand(DF_VOID_COMMAND, "void", NULL, "[ClearPlaylist %d]", room_id);
}


